<template>
	<view class="body">
		<view class="title-box"  @click="back()">
			<text class="iconfont icon-left"></text>
		</view>
		<view class="item">
			<view class="title" style="display: flex;">
				充值<span style="color: #D70000; display: block;">*</span>
			</view>
			<view class="in-ys">
				<input style="border: 0px;" placeholder="请输入充值数量" border="none" v-model="form.money" />
			</view>
		</view>
		<view class="button" @click="submit">提交</view>
	</view>
</template>

<script>
	import apis from '@/api/index.js'
	import G from '@/config/global.js'
	import {
		requestApi
	} from '@/utils/request.js'
	// 导入公共组件方法
	import common from '@/common/js/common.js';
	export default {
		data() {
			return {
				form: {

				}
			}
		},
		onLoad() {
			this.form.userId = uni.getStorageSync("user").userId
		},
		methods: {
			submit() {
				requestApi(apis.user.recharge,this.form,'post').then(res => {
					if (res.code == 200) {
						uni.showToast({
							icon: "success",
							title: "充值成功"
						})
						uni.setStorageSync("user",res.data);
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 2000)
					}
				})
			}
		}
	}
</script>

<style>
	.body {
		padding: 10px 32rpx 0;
		min-height: 100vh;
		background-image: url('../../static/bgc.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}

	.item {
		display: flex;
		padding: 24rpx 0px;
		align-items: center;
		position: relative;
		/* justify-content: space-between; */
		/* border-bottom: 1px solid #fafafa; */
	}

	.block {
		width: 100%;
		height: auto;
		border-bottom: 24rpx solid #F1F6FB;
		padding: 0 32rpx 32rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
	}

	.title {
		width: 160rpx;
		margin-right: 30rpx;
		font-family: 'PingFang SC';
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 40rpx;
		color: rgba(51, 51, 51, 0.4);
		text-align: left;
	}


	.in-ys {
		width: 80%;
		border-radius: 8rpx;
		background: #F6F6F6;
	}

	.button {
		position: absolute;
		bottom: 40rpx;
		width: 95%;
		left: 50%;
		transform: translateX(-50%);
		color: #fff;
		background-color: #07b1ff;
		padding: 32rpx;
		border-radius: 64rpx;
		text-align: center;
	}
</style>